package com.bgs.config.subscriberDirect;

import com.bgs.config.publisherDirect.BeforeDirectConfig;
import com.bgs.mapper.BeforeUserMapper;
import com.bgs.pojo.vo.ZeroReturnGoods;
import com.bgs.service.BeforeUserService;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class BeforeDircetRecive {
    @Resource
    private BeforeUserService beforeUserService;

    @RabbitListener(queues = "zero.publisherDirect.returnGoods.queue")
    public void recive(ZeroReturnGoods zeroReturnGoods, Channel channel, Message message) {
        log.info("WWWWW接收到" + zeroReturnGoods.toString());
        beforeUserService.zeroReturnGoodsAddBalance(zeroReturnGoods);
    }
}
